package com.ita.pojo;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.GenericGenerator;


/**
 * 
 * @author WENGTO2
 *
 */
@Entity
@Table(name = "food")
@GenericGenerator(strategy = "uuid", name = "uid")
public class Food {

	@Id
//	@GeneratedValue(generator = "uid")
	private String id;

	@Column(name = "name", length = 30)
	private String name;

	@Column(name = "price", columnDefinition = "number")
	private double price;

	@Column(name = "img")
	private String img;


	@ManyToOne()
	@JoinColumn(name="type_id")
	@Cascade(value = CascadeType.SAVE_UPDATE)
	private FoodType type;

//	@ManyToOne(targetEntity = Merchant.class,cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@ManyToOne
	@JoinColumn(name="m_id")
	@Cascade(value = CascadeType.SAVE_UPDATE)
	private MUser merchant;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public double getPrice() {
		return price;
	}

	public void setPrice(double price) {
		this.price = price;
	}

	public String getImg() {
		return img;
	}

	public void setImg(String img) {
		this.img = img;
	}


	

	

	public MUser getMerchant() {
		return merchant;
	}

	public void setMerchant(MUser merchant) {
		this.merchant = merchant;
	}

	public Food() {
		super();
	}

	public FoodType getType() {
		return type;
	}

	public void setType(FoodType type) {
		this.type = type;
	}

}
